var webdir='http://www.2admin.co.cc';
var limit=10;
var start=0;

var pageselect=1;
$(document).ready(function() {



}); 


function getmeeting()
{
    
    $.post(webdir+'/ajax.php',{functioncall:'getmeeting',start:start,limit:limit} ,function(data) {
    var view;
     var myObject = eval('(' + data + ')');
            
            $('#meetingrow').html('');
            if(myObject.count>0)
            { 
            for (variable in myObject.data)
             {   
                 
                 var obj = myObject.data[variable]; 
               if(obj.pic)
               {
                   var pic=obj.cover;
               }else
               {
                   var pic='meeting_user.jpg';
               }
               var str='<li><div class="member"><img height="60" width="60" src="images/'+pic+'"></div><div class="post"><a href="javascript:changepage2('+obj.meetid+')"><h3>'+obj.mtitle+'<span class="meta">['+obj.createdate+']</span></h3>'+obj.mdetail+'</a><span class="num green">'+obj.count+'</span></div></li>';

               $('#meetingrow').append(str);  
          //   alert(variable) ;
         
             
             
  
            }
                         var totalpage=Math.ceil((myObject.count)/(limit) );
             
             $('.pagebarUTH').html('');
             $('.pagebarUTH').append('<a href="javascript:;" title="Seite 2">จำนวน '+myObject.count+'</a>&nbsp;');
             if(totalpage!=1)
             {
                var previous= totalpage-1;
                 $('.pagebarUTH').append('<a href="javascript:changepage('+previous+');" title="Seite 2"><< Previous</a>&nbsp;');
             }
             
             for(var i=1;i<=totalpage;i++)
             {
                 if(i==pageselect)
                 {
                  var strlink='<span class="this-page">'+i+'</span>';   
                 }else
                 {
                  var strlink='<a href="javascript:changepage('+i+');" title="Seite 2">'+i+'</a>';    
                 }
                 $('.pagebarUTH').append(strlink);
                 
             }
             
             if(totalpage!=1)
             {
                var next= totalpage+1;
                 $('.pagebarUTH').append('<a href="javascript:changepage('+next+');" title="Seite 2">Next >></a>');
                 $('.pagebarUTH').append('<a href="javascript:changepage('+totalpage+');" title="Seite 2">Last</a>');
             }
            }
     
});
    
}
function changepage2(meetid)
{
    location.href='submeeting.html?meetid='+meetid;
}